package com.hunt.model.app.nuggets;


import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;



/**
 * @author ww
 * @className
 * @description
 * @date 2020/8/25
 */

@Data
@AllArgsConstructor
@NoArgsConstructor
@ToString
public class HqIndexData implements Comparable<HqIndexData>{

    //消息ID
    private String msgId;
    //代码
    private String code;
    //日期
    private String dateTime;
    //是否盘中数据
    private boolean opening;
    //昨天收盘价*10000
    private float preClose;
    //开盘价*10000
    private float open;
    //最新价*10000
    private float newPrice;
    //最高价*10000
    private float high;
    //最低价*10000
    private float low;
    //股数（单位：个股）
    private long vol;
    //成交额*100
    private long money;
    //涨跌幅
    private String hlPercent;
    //涨跌额
    private String change;


    @Override
    public int compareTo(HqIndexData o) {
        Float thisHlPercent = Float.valueOf(this.hlPercent.replaceAll("%", ""));
        Float oHlPercent = Float.valueOf(o.hlPercent.replaceAll("%", ""));
        if (thisHlPercent - oHlPercent > 0){
            return 1;
        }else if (thisHlPercent - oHlPercent < 0){
            return -1;
        }else{
            return 0;
        }
    }
}
